<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Document</title>
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<br>
<center>
    <h2>post 测试</h2>
</center>
<hr>
<div>
<form class="navbar-form navbar-left" role="search" name="myform">
    <div class="form-group">
        <input type="text" class="form-control" placeholder="username" name="username" value="">
    </div>
    <br>

    <div class="form-group">
        <input type="text" class="form-control" placeholder="password" name="password" value="">
    </div>
    <br>

    <div class="form-group">
        <input type="text" class="form-control" placeholder="age" name="age" value="">
    </div>
    <br>

    <div class="form-group">
        <input type="text" class="form-control" placeholder="sex" name="sex" value="">
    </div>
    <br>
    <button type="button" onclick="formSubmit()" class="btn btn-default">提交1</button>
</form>
</div>
</body>
<script src="/js/app.js"></script>
<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    function formSubmit(){
        var username=myform.username.value;
        var password=myform.password.value;
        var age=myform.age.value;
        var sex=myform.sex.value;
        if(username.length == ''){
            alert('buneng');
        }
        // console.log(username);
        // console.log(password);
        // console.log(age);
        // console.log(sex);
        $.post('/index/front/postTest',
            {
                'username':username,
                'password':password,
                'age':age,
                'sex':sex
            },function(data){
            console.log(data);
            alert(data);
        })
    }
</script>
</html>